home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 February: Tool Chest / Apple Developer CD Series Tool Chest February 1996 (Apple Computer)(1996).iso / Tool Chest / Development Tools & Languages / Macintosh Common Lisp Related / interfaces / PInterface Translator / PInterfaces / PrintTraps.p < prev    next >
Encoding:
Text File  |  1993-09-16  |  10.1 KB  |  388 lines  |  [TEXT/MPS ]

  1. {
  2. Created: Tuesday, August 2, 1988 at 9:06 AM
  3.     PrintTraps.p
  4.     Pascal Interface to the Macintosh Libraries
  5.  
  6.     Copyright Apple Computer, Inc.    1985-1988
  7.     All rights reserved
  8. }
  9.  
  10.  
  11. {$IFC UNDEFINED UsingIncludes}
  12. {$SETC UsingIncludes := 0}
  13. {$ENDC}
  14.  
  15. {$IFC NOT UsingIncludes}
  16.     UNIT PrintTraps;
  17.     INTERFACE
  18. {$ENDC}
  19.  
  20. {$IFC UNDEFINED UsingPrintTraps}
  21. {$SETC UsingPrintTraps := 1}
  22.  
  23. {$I+}
  24. {$SETC PrintTrapsIncludes := UsingIncludes}
  25. {$SETC UsingIncludes := 1}
  26. {$IFC UNDEFINED UsingQuickdraw}
  27. {$I $$Shell(PInterfaces)Quickdraw.p}
  28. {$ENDC}
  29. {$IFC UNDEFINED UsingDialogs}
  30. {$I $$Shell(PInterfaces)Dialogs.p}
  31. {$ENDC}
  32. {$SETC UsingIncludes := PrintTrapsIncludes}
  33.  
  34. CONST
  35. bDraftLoop = 0;
  36. bSpoolLoop = 1;
  37. iPFMaxPgs = 128;                        {Max number of pages in a print file.}
  38. iPrPgFract = 120;
  39. iPrPgFst = 1;                            {Page range constants}
  40. iPrPgMax = 9999;
  41. iPrRelease = 2;                         {Current version number of the code.}
  42. iPrSavPFil = -1;
  43. iIOAbort = -27;
  44. pPrGlobals = $00000944;
  45. bUser1Loop = 2;
  46. bUser2Loop = 3;
  47. fNewRunBit = 2;                         {Bit 2 (3rd bit) in bDocLoop is new JobRun indicator.}
  48. fHiResOK = 3;                            {Bit 3 (4th bit) in bDocLoop is hi res indicator for paint.}
  49. fWeOpenedRF = 4;                        {Bit 4 (5th bit) in bDocLoop is set if driver opened the pr res file.}
  50. iPrAbort = 128;
  51. iPrDevCtl = 7;                            {The PrDevCtl Proc's ctl number}
  52. lPrReset = $00010000;                    {The PrDevCtl Proc's CParam for reset}
  53. lPrLineFeed = $00030000;
  54. lPrLFStd = $0003FFFF;                    {The PrDevCtl Proc's CParam for std paper advance}
  55. lPrLFSixth = $0003FFFF;
  56. lPrPageEnd = $00020000;                 {The PrDevCtl Proc's CParam for end page}
  57. lPrDocOpen = $00010000;                 {note: same as lPrReset low order byte indicates number of copies to print}
  58. lPrPageOpen = $00040000;
  59. lPrPageClose = $00020000;                {note: same as lPrPageEnd}
  60. lPrDocClose = $00050000;
  61. iFMgrCtl = 8;                            {The FMgr's Tail-hook Proc's ctl number}
  62. iMscCtl = 9;                            {Msc Text state / Drvr State ctl number}
  63. iPvtCtl = 10;                            {Private ctls start here}
  64. iMemFullErr = -108;
  65.  
  66. {
  67. Driver constants }
  68.  
  69. iPrBitsCtl = 4;                         {The Bitmap Print Proc's ctl number}
  70. lScreenBits = 0;                        {The Bitmap Print Proc's Screen Bitmap param}
  71. lPaintBits = 1;                         {The Bitmap Print Proc's Paint [sq pix] param}
  72. lHiScreenBits = $00000002;                {The Bitmap Print Proc's Screen Bitmap param}
  73. lHiPaintBits = $00000003;                {The Bitmap Print Proc's Paint [sq pix] param}
  74. iPrIOCtl = 5;                            {The Raw Byte IO Proc's ctl number}
  75. iPrEvtCtl = 6;                            {The PrEvent Proc's ctl number}
  76. lPrEvtAll = $0002FFFD;                    {The PrEvent Proc's CParam for the entire screen}
  77. lPrEvtTop = $0001FFFD;                    {The PrEvent Proc's CParam for the top folder}
  78. iPrDrvrRef = -3;
  79. getRslDataOp = 4;                        {PrGeneral Cs}
  80. setRslOp = 5;                            {PrGeneral Cs}
  81. draftBitsOp = 6;                        {PrGeneral Cs}
  82. noDraftBitsOp = 7;                        {PrGeneral Cs}
  83. getRotnOp = 8;                            {PrGeneral Cs}
  84. NoSuchRsl = 1;                            {PrGeneral Cs}
  85. RgType1 = 1;                            {PrGeneral Cs}
  86.  
  87.  
  88. TYPE
  89.  
  90. TFeed = (feedCut,feedFanfold,feedMechCut,feedOther);
  91.  
  92. TScan = (scanTB,scanBT,scanLR,scanRL);
  93.  
  94.  
  95. TPPrPort = ^TPrPort;
  96. TPrPort = RECORD
  97.     gPort: GrafPort;                    {The Printer's graf port.}
  98.     gProcs: QDProcs;                    {..and its procs}
  99.     lGParam1: LONGINT;                    {16 bytes for private parameter storage.}
  100.     lGParam2: LONGINT;
  101.     lGParam3: LONGINT;
  102.     lGParam4: LONGINT;
  103.     fOurPtr: BOOLEAN;                    {Whether the PrPort allocation was done by us.}
  104.     fOurBits: BOOLEAN;                    {Whether the BitMap allocation was done by us.}
  105.     END;
  106.  
  107. { Printing Graf Port. All printer imaging, whether spooling, banding, etc, happens "thru" a GrafPort.
  108. This is the "PrPeek" record. }
  109.  
  110. TPPrInfo = ^TPrInfo;
  111. TPrInfo = RECORD
  112.     iDev: INTEGER;                        {Font mgr/QuickDraw device code}
  113.     iVRes: INTEGER;                     {Resolution of device, in device coordinates}
  114.     iHRes: INTEGER;                     {..note: V before H => compatable with Point.}
  115.     rPage: Rect;                        {The page (printable) rectangle in device coordinates.}
  116.     END;
  117.  
  118. { Print Info Record: The parameters needed for page composition. }
  119. TPPrStl = ^TPrStl;
  120. TPrStl = RECORD
  121.     wDev: INTEGER;                        {The device (driver) number. Hi byte=RefNum, Lo byte=variant. f0 = fHiRes f1 = fPortrait, f2 = fSqPix, f3 = f2xZoom, f4 = fScroll.}
  122.     iPageV: INTEGER;                    {paper size in units of 1/iPrPgFract}
  123.     iPageH: INTEGER;                    { ..note: V before H => compatable with Point.}
  124.     bPort: SignedByte;                    {The IO port number. Refnum?}
  125.     feed: TFeed;                        {paper feeder type.}
  126.     END;
  127.  
  128. { Printer Style: The printer configuration and usage information. }
  129. TPPrXInfo = ^TPrXInfo;
  130. TPrXInfo = RECORD
  131.     iRowBytes: INTEGER;
  132.     iBandV: INTEGER;
  133.     iBandH: INTEGER;
  134.     iDevBytes: INTEGER;
  135.     iBands: INTEGER;
  136.     bPatScale: SignedByte;
  137.     bUlThick: SignedByte;
  138.     bUlOffset: SignedByte;
  139.     bUlShadow: SignedByte;
  140.     scan: TScan;
  141.     bXInfoX: SignedByte;
  142.     END;
  143.  
  144. TPPrJob = ^TPrJob;
  145. TPrJob = RECORD
  146.     iFstPage: INTEGER;
  147.     iLstPage: INTEGER;
  148.     iCopies: INTEGER;
  149.     bJDocLoop: SignedByte;
  150.     fFromUsr: BOOLEAN;
  151.     pIdleProc: ProcPtr;
  152.     pFileName: StringPtr;
  153.     iFileVol: INTEGER;
  154.     bFileVers: SignedByte;
  155.     bJobX: SignedByte;
  156.     END;
  157.  
  158. TPrFlag1 = PACKED RECORD
  159.     f15: BOOLEAN;
  160.     f14: BOOLEAN;
  161.     f13: BOOLEAN;
  162.     f12: BOOLEAN;
  163.     f11: BOOLEAN;
  164.     f10: BOOLEAN;
  165.     f9: BOOLEAN;
  166.     f8: BOOLEAN;
  167.     f7: BOOLEAN;
  168.     f6: BOOLEAN;
  169.     f5: BOOLEAN;
  170.     f4: BOOLEAN;
  171.     f3: BOOLEAN;
  172.     f2: BOOLEAN;
  173.     fLstPgFst: BOOLEAN;
  174.     fUserScale: BOOLEAN;
  175.     END;
  176.  
  177. TPPrint = ^TPrint;
  178. THPrint = ^TPPrint;
  179. TPrint = RECORD
  180.     iPrVersion: INTEGER;
  181.     prInfo: TPrInfo;
  182.     rPaper: Rect;
  183.     prStl: TPrStl;
  184.     prInfoPT: TPrInfo;
  185.     prXInfo: TPrXInfo;
  186.     prJob: TPrJob;
  187.     CASE INTEGER OF
  188.       0:
  189.         (printX: ARRAY [1..19] OF INTEGER);
  190.       1:
  191.         (prFlag1: TPrFlag1;             {a word of flags}
  192.         iZoomMin: INTEGER;
  193.         iZoomMax: INTEGER;
  194.         hDocName: StringHandle);        {current doc's name, nil = front window}
  195.     END;
  196.  
  197. TPPrStatus = ^TPrStatus;
  198. TPrStatus = RECORD
  199.     iTotPages: INTEGER;                 {Total pages in Print File.}
  200.     iCurPage: INTEGER;                    {Current page number}
  201.     iTotCopies: INTEGER;                {Total copies requested}
  202.     iCurCopy: INTEGER;                    {Current copy number}
  203.     iTotBands: INTEGER;                 {Total bands per page.}
  204.     iCurBand: INTEGER;                    {Current band number}
  205.     fPgDirty: BOOLEAN;                    {True if current page has been written to.}
  206.     fImaging: BOOLEAN;                    {Set while in band's DrawPic call.}
  207.     hPrint: THPrint;                    {Handle to the active Printer record}
  208.     pPrPort: TPPrPort;                    {Ptr to the active PrPort}
  209.     hPic: PicHandle;                    {Handle to the active Picture}
  210.     END;
  211.  
  212. { Print Status: Print information during printing. }
  213. TPPfPgDir = ^TPfPgDir;
  214. THPfPgDir = ^TPPfPgDir;
  215. TPfPgDir = RECORD
  216.     iPages: INTEGER;
  217.     iPgPos: ARRAY [0..128] OF LONGINT;    {ARRAY [0..iPfMaxPgs] OF LONGINT}
  218.     END;
  219.  
  220. { PicFile = a TPfHeader followed by n QuickDraw Pics (whose PicSize is invalid!) }
  221. TPPrDlg = ^TPrDlg;
  222. TPrDlg = RECORD
  223.     Dlg: DialogRecord;                    {The Dialog window}
  224.     pFltrProc: ProcPtr;                 {The Filter Proc.}
  225.     pItemProc: ProcPtr;                 {The Item evaluating proc.}
  226.     hPrintUsr: THPrint;                 {The user's print record.}
  227.     fDoIt: BOOLEAN;
  228.     fDone: BOOLEAN;
  229.     lUser1: LONGINT;                    {Four longs for user's to hang global data.}
  230.     lUser2: LONGINT;                    {...Plus more stuff needed by the particular printing dialog.}
  231.     lUser3: LONGINT;
  232.     lUser4: LONGINT;
  233.     END;
  234.  
  235. TGnlData = RECORD
  236.     iOpCode: INTEGER;
  237.     iError: INTEGER;
  238.     lReserved: LONGINT;                 {more fields here depending on call}
  239.     END;
  240.  
  241. TRslRg = RECORD
  242.     iMin: INTEGER;
  243.     iMax: INTEGER;
  244.     END;
  245.  
  246. TRslRec = RECORD
  247.     iXRsl: INTEGER;
  248.     iYRsl: INTEGER;
  249.     END;
  250.  
  251. TGetRslBlk = RECORD
  252.     iOpCode: INTEGER;
  253.     iError: INTEGER;
  254.     lReserved: LONGINT;
  255.     iRgType: INTEGER;
  256.     xRslRg: TRslRg;
  257.     yRslRg: TRslRg;
  258.     iRslRecCnt: INTEGER;
  259.     rgRslRec: ARRAY [1..27] OF TRslRec;
  260.     END;
  261.  
  262. TSetRslBlk = RECORD
  263.     iOpCode: INTEGER;
  264.     iError: INTEGER;
  265.     lReserved: LONGINT;
  266.     hPrint: THPrint;
  267.     iXRsl: INTEGER;
  268.     iYRsl: INTEGER;
  269.     END;
  270.  
  271. TDftBitsBlk = RECORD
  272.     iOpCode: INTEGER;
  273.     iError: INTEGER;
  274.     lReserved: LONGINT;
  275.     hPrint: THPrint;
  276.     END;
  277.  
  278. TGetRotnBlk = RECORD
  279.     iOpCode: INTEGER;
  280.     iError: INTEGER;
  281.     lReserved: LONGINT;
  282.     hPrint: THPrint;
  283.     fLandscape: BOOLEAN;
  284.     bXtra: SignedByte;
  285.     END;
  286.  
  287. TPRect = ^Rect;                         { A Rect Ptr }
  288.  
  289. TPBitMap = ^BitMap;                     { A BitMap Ptr }
  290.  
  291. TN = 0..15;                             { a Nibble }
  292.  
  293. TPWord = ^TWord;
  294. THWord = ^TPWord;
  295. TWord = PACKED RECORD
  296.     CASE INTEGER OF
  297.       0:
  298.         (c1,c0: CHAR);
  299.       1:
  300.         (b1,b0: SignedByte);
  301.       2:
  302.         (usb1,usb0: Byte);
  303.       3:
  304.         (n3,n2,n1,n0: TN);
  305.       4:
  306.         (f15,f14,f13,f12,f11,f10,f9,f8,f7,f6,f5,f4,f3,f2,f1,f0: BOOLEAN);
  307.       5:
  308.         (i0: INTEGER);
  309.     END;
  310.  
  311. TPLong = ^TLong;
  312. THLong = ^TPLong;
  313. TLong = RECORD
  314.     CASE INTEGER OF
  315.       0:
  316.         (w1,w0: TWord);
  317.       1:
  318.         (b1,b0: LONGINT);
  319.       2:
  320.         (p0: Ptr);
  321.       3:
  322.         (h0: Handle);
  323.       4:
  324.         (pt: Point);
  325.     END;
  326.  
  327.  
  328.  
  329. PROCEDURE PrPurge;
  330.     INLINE $2F3C,$A800,$0000,$A8FD;
  331. PROCEDURE PrNoPurge;
  332.     INLINE $2F3C,$B000,$0000,$A8FD;
  333. FUNCTION PrDrvrDCE: Handle;
  334.     INLINE $2F3C,$9400,$0000,$A8FD;
  335. FUNCTION PrDrvrVers: INTEGER;
  336.     INLINE $2F3C,$9A00,$0000,$A8FD;
  337. PROCEDURE PrOpen;
  338.     INLINE $2F3C,$C800,$0000,$A8FD;
  339. PROCEDURE PrClose;
  340.     INLINE $2F3C,$D000,$0000,$A8FD;
  341. PROCEDURE PrintDefault(hPrint: THPrint);
  342.     INLINE $2F3C,$2004,$0480,$A8FD;
  343. FUNCTION PrValidate(hPrint: THPrint): BOOLEAN;
  344.     INLINE $2F3C,$5204,$0498,$A8FD;
  345. FUNCTION PrStlDialog(hPrint: THPrint): BOOLEAN;
  346.     INLINE $2F3C,$2A04,$0484,$A8FD;
  347. FUNCTION PrJobDialog(hPrint: THPrint): BOOLEAN;
  348.     INLINE $2F3C,$3204,$0488,$A8FD;
  349. PROCEDURE PrJobMerge(hPrintSrc: THPrint;hPrintDst: THPrint);
  350.     INLINE $2F3C,$5804,$089C,$A8FD;
  351. FUNCTION PrOpenDoc(hPrint: THPrint;pPrPort: TPPrPort;pIOBuf: Ptr): TPPrPort;
  352.     INLINE $2F3C,$0400,$0C00,$A8FD;
  353. PROCEDURE PrCloseDoc(pPrPort: TPPrPort);
  354.     INLINE $2F3C,$0800,$0484,$A8FD;
  355. PROCEDURE PrOpenPage(pPrPort: TPPrPort;pPageFrame: TPRect);
  356.     INLINE $2F3C,$1000,$0808,$A8FD;
  357. PROCEDURE PrClosePage(pPrPort: TPPrPort);
  358.     INLINE $2F3C,$1800,$040C,$A8FD;
  359. PROCEDURE PrPicFile(hPrint: THPrint;pPrPort: TPPrPort;pIOBuf: Ptr;pDevBuf: Ptr;
  360.     VAR prStatus: TPrStatus);
  361.     INLINE $2F3C,$6005,$1480,$A8FD;
  362. FUNCTION PrError: INTEGER;
  363.     INLINE $2F3C,$BA00,$0000,$A8FD;
  364. PROCEDURE PrSetError(iErr: INTEGER);
  365.     INLINE $2F3C,$C000,$0200,$A8FD;
  366. PROCEDURE PrGeneral(pData: Ptr);
  367.     INLINE $2F3C,$7007,$0480,$A8FD;
  368. PROCEDURE PrDrvrOpen;
  369.     INLINE $2F3C,$8000,$0000,$A8FD;
  370. FUNCTION PrDlgMain(hPrint: THPrint;pDlgInit: ProcPtr): BOOLEAN;
  371.     INLINE $2F3C,$4A04,$0894,$A8FD;
  372. PROCEDURE PrDrvrClose;
  373.     INLINE $2F3C,$8800,$0000,$A8FD;
  374. FUNCTION PrJobInit(hPrint: THPrint): TPPrDlg;
  375.     INLINE $2F3C,$4404,$0410,$A8FD;
  376. PROCEDURE PrCtlCall(iWhichCtl: INTEGER;lParam1: LONGINT;lParam2: LONGINT;
  377.     lParam3: LONGINT);
  378.     INLINE $2F3C,$A000,$0E00,$A8FD;
  379. FUNCTION PrStlInit(hPrint: THPrint): TPPrDlg;
  380.     INLINE $2F3C,$3C04,$040C,$A8FD;
  381.  
  382. {$ENDC}    { UsingPrintTraps }
  383.  
  384. {$IFC NOT UsingIncludes}
  385.     END.
  386. {$ENDC}
  387.  
  388.